USE [HomestayWebDB]
GO
/****** Object:  StoredProcedure [dbo].[Store_User_GetAuthorOfPost]    Script Date: 11/26/2012 17:41:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Store_User_GetAuthorOfPost]
	@PostID int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT u.Username,
		   u.Email,
		   u.Phone,
		   u.Fullname,
		   u.AvatarPicture
	FROM Users u, Posts p
	WHERE p.PostID = @PostID AND u.Username = p.Username AND 
		  p.IsDeleted = 'False' AND u.IsDeleted = 'False' --Check Role later
END
